package com.googlecode.bluetools.common.utils;

public class ClassUtil {

	public static String backslashToSlash(String str) {
		if (str.indexOf('\\') >= 0) {
			return str.replace('\\', '/');
		}
		return str;
	}

	/**
	 * Convert class name to slashed format. If the class name is already in slashed format, it is returned unmodified.
	 * 
	 * @param className a class name
	 * @return the same class name in slashed format
	 */
	public static String toSlashedClassName(String className) {
		if (className.indexOf('.') >= 0) {
			return className.replace('.', '/');
		}
		return className;
	}

	public static String toDottedClassName(String className) {
		if (className.indexOf('/') >= 0) {
			return className.replace('/', '.');
		}
		return className;
	}
}
